<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Cal extends CI_Controller {

	/**
	 * Index Page for this controller.
	 *
	 * Maps to the following URL
	 * 		http://example.com/index.php/welcome
	 *	- or -  
	 * 		http://example.com/index.php/welcome/index
	 *	- or -
	 * Since this controller is set as the default controller in 
	 * config/routes.php, it's displayed at http://example.com/
	 *
	 * So any other public methods not prefixed with an underscore will
	 * map to /index.php/welcome/<method_name>
	 * @see http://codeigniter.com/user_guide/general/urls.html
	 */
	public function index()
	{
		echo htmlspecialchars( "&timestamp" );
		exit();
		$this->load->view('common.html');
	}

	public function common(){
		$this->load->view('common.html');
	}

	public function special(){
		$this->load->view('speclass/class0.html');
	}

	public function system(){
		$this->load->view('system/class0.html');
	}
	public function test(){
		$this->load->view('random/home.html');
	}

	public function conView(){
		$calc = $_GET['calc'];
		$sort = $_GET['sort'];
		
		switch ($sort) {
			case 0:

				$this->data['sort_link'] = config_item("main_link")."common";
				$this->data['sort_text'] = "通用";

				$this->data['class_link'] = '';
				$this->data['class_text'] = '';
				break;
			
			case 1:
				$class = $_GET['class'];
				$this->data['sort_link'] = config_item("main_link").'special';
				$this->data['sort_text'] = '专科';
				switch ($class) {
					case 0:
						$this->data['class_link'] = config_item("main_link")."speclass?class=0";
						$this->data['class_text'] = '心脏病学';
						break;
					case 1:
						$this->data['class_link'] = config_item("main_link")."speclass?class=1";
						$this->data['class_text'] = '危重病人医疗';
						break;
					case 2:
						$this->data['class_link'] = config_item("main_link")."speclass?class=2";
						$this->data['class_text'] = '内分泌学';
						break;

					case 3:
						$this->data['class_link'] = config_item("main_link")."speclass?class=3";
						$this->data['class_text'] = '胃肠病学';
						break;
					case 4:
						$this->data['class_link'] = config_item("main_link")."speclass?class=4";
						$this->data['class_text'] = '血液病学/肿瘤学';
						break;
					case 5:
						$this->data['class_link'] = config_item("main_link")."speclass?class=5";
						$this->data['class_text'] = '肝脏病学';
						break;
					case 6:
						$this->data['class_link'] = config_item("main_link")."speclass?class=6";
						$this->data['class_text'] = '传染病学';
						break;
					case 7:
						$this->data['class_link'] = config_item("main_link")."speclass?class=7";
						$this->data['class_text'] = '肾脏病学';
						break;
					case 8:
						$this->data['class_link'] = config_item("main_link")."speclass?class=8";
						$this->data['class_text'] = '神经病学';
						break;
					case 9:
						$this->data['class_link'] = config_item("main_link")."speclass?class=9";
						$this->data['class_text'] = '妇产科';
						break;
					case 10:
						$this->data['class_link'] = config_item("main_link")."speclass?class=10";
						$this->data['class_text'] = '矫形外科学';
						break;
					case 11:
						$this->data['class_link'] = config_item("main_link")."speclass?class=11";
						$this->data['class_text'] = '儿科学';
						break;
					case 12:
						$this->data['class_link'] = config_item("main_link")."speclass?class=12";
						$this->data['class_text'] = '肺病学';
						break;
					case 13:
						$this->data['class_link'] = config_item("main_link")."speclass?class=13";
						$this->data['class_text'] = '外科学';
						break;
					case 14:
						$this->data['class_link'] = config_item("main_link")."speclass?class=14";
						$this->data['class_text'] = '毒理学';
						break;
					case 15:
						$this->data['class_link'] = config_item("main_link")."speclass?class=15";
						$this->data['class_text'] = '创伤外科';
						break;
					case 16:
						$this->data['class_link'] = config_item("main_link")."speclass?class=16";
						$this->data['class_text'] = '麻醉学';
						break;
					
					default:
						$this->data['class_link'] = config_item("main_link")."speclass?class=0";
						$this->data['class_text'] = '心脏病学';
						break;
				}
				break;
			case 2:
				$class = $_GET['class'];
				$this->data['sort_link'] = config_item("main_link").'system';
				$this->data['sort_text'] = '系统';
				switch ($class) {
					case 0:
						$this->data['class_link'] = config_item("main_link")."sysclass?class=0";
						$this->data['class_text'] = '心脏系统';
						break;
					case 1:
						$this->data['class_link'] = config_item("main_link")."sysclass?class=1";
						$this->data['class_text'] = '内分泌/代谢系统';
						break;
					case 2:
						$this->data['class_link'] = config_item("main_link")."sysclass?class=2";
						$this->data['class_text'] = '胃肠道系统';
						break;
					case 3:
						$this->data['class_link'] = config_item("main_link")."sysclass?class=3";
						$this->data['class_text'] = '血液系统';
						break;
					case 4:
						$this->data['class_link'] = config_item("main_link")."sysclass?class=4";
						$this->data['class_text'] = '免疫系统';
						break;
					case 5:
						$this->data['class_link'] = config_item("main_link")."sysclass?class=5";
						$this->data['class_text'] = '肌肉骨骼系统';
						break;
					case 6:
						$this->data['class_link'] = config_item("main_link")."sysclass?class=6";
						$this->data['class_text'] = '神经系统';
						break;
					case 7:
						$this->data['class_link'] = config_item("main_link")."sysclass?class=7";
						$this->data['class_text'] = '肾脏系统';
						break;
					case 8:
						$this->data['class_link'] = config_item("main_link")."sysclass?class=8";
						$this->data['class_text'] = '呼吸系统';
						break;
					default:
						$this->data['class_link'] = config_item("main_link")."sysclass?class=0";
						$this->data['class_text'] = '心脏系统';
						break;
				}
				break;
		}

		$calc = "calc-".$calc;
		$this->data['sort'] = $sort;
		$this->data['calc'] = $calc;
		$this->load->view("content.html",$this->data);

		// var_dump($this->data);
	}

	public function speclass(){
		$class = $_GET['class'];
		$this->load->view("speclass/"."class".$class.".html");
	}

	public function sysclass(){
		$class = $_GET['class'];
		$this->load->view("system/"."class".$class.".html");
	}

	public function usedTime(){
		
	}
}
/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */
